#!/bin/bash

#initial 
scriptdir=`pwd`
mkdir ~/linlab6 2> /dev/null
cd ~/linlab6

# 1 ------
cat /etc/apt/sources.list | grep -E '^deb' | awk -F" " '{ print $3 " " $4 " " $5 " " $2}' > work6.log

# 2 -------
apt-get install reprepro alien --assume-yes

# 3 ------
apt-get update
apt-cache search rpm --names-only >> work6.log

# 4 ------
mkdir ~/localrepo
mkdir ~/localrepo/conf
mkdir ~/localrepo/incoming
cp $scriptdir/distributions ~/localrepo/conf/distributions
# Kudos to Bulat. He helped me with distrs config


# 5 & 6 ------
reprepro -Vb ~/localrepo -C main includedeb CheezburgerRepo $scriptdir/files/iptraf_3.0.0-6build1_i386.deb

# 7 ------
cat /etc/apt/sources.list | grep -E '^deb' | awk -F" " '{ print $2}' >> work6.log

# 8 ------
cp /etc/apt/sources.list /etc/apt/sources.list.backup

# 9 ------
echo 'deb file:/home/vladimir/localrepo CheezburgerRepo main' > /etc/apt/sources.list

# 10 ------
apt-get update
apt-get install iptraf

# 11 ------
cp /etc/apt/sources.list.backup /etc/apt/sources.list

# 12 ------
alien --to-deb $scriptdir/files/medit-0.9.3-1.fc8.src.rpm

# 13 ------
tar -xzvf $scriptdir/files/bzip2_1.0.5.orig.tar.gz -C .
cd bzip2-1.0.5
make && make install





